<?php 

use yii\helpers\Url;

?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <link rel="stylesheet" type="text/css" href="<?= Url::to('@web/campaign/jselect/artistic/index.css', true) ?>"/>
    <link rel="stylesheet" type="text/css" href="<?= Url::to('@web/campaign/jselect/artistic/animate.css', true) ?>"/>
    <script type="text/javascript" src="<?= Url::to('@web/campaign/jselect/artistic/jq.js', true) ?>"></script>
    <title></title>
</head>
<body>
    <div id="CustomView">
        <div id="WebformHtmlView">
            <div id="errorForm" class="txt5" style="display: none;text-align:center;">
            </div>
            <div class="main">
                <div class="wrap">
                    <div class="logo">
                        <img class="logoimg" src="<?= Url::to('@web/campaign/jselect/artistic/jselect.jpg', true) ?>" alt="" width="300" height="97" />
                    </div>
                    <div class="broad animated zoomIn">
                        <div id="errTb" class="box error" style="clear: both; padding: 3px 0px;">&nbsp;</div>
                        <div class="banner animated zoomIn">
                            <div class="form-banner">&nbsp;</div>
                            <div class="form-bannerm">&nbsp;</div>
                        </div>
                        <div class="middlecontent animated fadeInUp">
                            <div class="content1">
                                <div class="formmain">
                                    <!-- ********************************************************************************************************************************* -->
                                    <!-- <form id="formPreview" class="survey_form newform" action="https://proxcrm.xgate.com/app/index.php/webforms/form/form?encid=7507a565-4971-cfe9-4d17-4a6c9249580e&tracker=1b9de568-cef6-2ce3-080c-30b09353606b"
                                        method="post"> -->
                                        <div style="padding-top: 55%; width: 250px; margin: 0 auto;">
                                            <!-- <img src="https://webform.xgate.com/barcode/frontend/web/index.php?r=qr/barcode&code=DC00101823801&type=code39"
                                                alt="" width="200" height="50" /> -->
                                        </div>
                                        <!-- ********************************************************************************************************************************* -->
                                        <!-- <div style="color: #000; text-align: center; padding-top: 5px; font-size: 16px;">DC00101823801</div> -->
                                        <div class="scfSubmitButtonBorder2 js-getCoupon hide" style="margin: 0 auto; text-align: center;">
                                            <button id="submitFormBtn" style="max-width: 310px; white-space: pre-wrap;" type="button">立即领取</button>&nbsp;
                                            <input name="mode" id="mode" type="hidden" />
                                        </div>
                                        <div class="scfSubmitButtonBorder2 js-myCoupon hide" style="margin: 0 auto; text-align: center;">
                                            <button id="submitFormBtn" style="max-width: 310px; white-space: pre-wrap;" type="button">我的优惠券</button>&nbsp;
                                            <input name="mode" id="mode" type="hidden" />
                                        </div>
                                        <div class="scfSubmitButtonBorder2 js-register hide" style="margin: 0 auto; text-align: center;">
                                            <button id="submitFormBtn" style="max-width: 310px; white-space: pre-wrap;" type="button">注册领券</button>&nbsp;
                                            <input name="mode" id="mode" type="hidden" />
                                        </div>
                                        <div>
                                        	<input type="checkbox" name="allow">
                                        	同意成为会员
                                        </div>
                                        <div class="copy hide js-copy">
                                            <button type="button" id="brandName">JSELECT</button>
                                            <p>(点击按钮复制名称,在微信中搜索公众号)</p>
                                            <input id="copyBrandName"></input>
                                        </div>
                                        <div style="clear: both; display: block; margin: 0 auto; text-align: center; padding-top: 8px;">
                                            <input name="externalRequestToken" id="externalRequestToken" type="hidden" value="03a5a02f90475fd" />
                                            <input name="useofficialrule" id="useofficialrule" type="hidden" value="0" />
                                            <input name="mandatoryofficialrule" id="mandatoryofficialrule" type="hidden" value="1" />
                                        </div>
                                        <div class="redeem_txt" style="text-align: initial;">
                                            <div>尊享好礼：
                                                <span>J SELECT 100元现金券及限量帆布包</span>
                                            </div>
                                            <div>活动时间：
                                                <span>8.6 - 8.15</span>
                                            </div>
                                            <div>垂询热线：
                                                <span>4009 200 618</span>
                                            </div>
                                            <div style="white-space: nowrap;">领取地点
                                                <span>：&nbsp;</span>
                                            </div>
                                            <div style="display: flex;">
                                                <div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">北京王府中环中心</div>
                                                        <div>北京市东城区王府井大街269号王府中环416A</div>
                                                    </div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">北京金融街购物中心</div>
                                                        <div>北京市西城区金融街金城坊街2号金融街购物中心B1层</div>
                                                    </div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">北京蓝色港湾</div>
                                                        <div>北京市朝阳区朝阳公园路6号院1号楼M层</div>
                                                    </div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">北京荟聚购物中心</div>
                                                        <div>北京市大兴区欣宁街15号1号楼3层</div>
                                                    </div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">北京合生汇购物中心</div>
                                                        <div>北京市朝阳区西大望路甲22号院1号楼合生汇4层</div>
                                                    </div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">北京双安</div>
                                                        <div>北京市海淀区北三环西路38号双安商场5层</div>
                                                    </div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">上海伊势丹</div>
                                                        <div>上海市静安区南京西路1038号6F</div>
                                                    </div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">上海大丸百货</div>
                                                        <div>上海市黄浦区南京东路228号6F</div>
                                                    </div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">上海高岛屋</div>
                                                        <div>上海市长宁区虹桥路1438号6F</div>
                                                    </div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">上海长宁来福士</div>
                                                        <div>上海市长宁区长宁路1139号长宁来福士B1</div>
                                                    </div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">深圳皇庭广场</div>
                                                        <div>深圳市福田区福华三路118号皇庭广场L1层</div>
                                                    </div>
                                                    <div style="display: flex;">
                                                        <div class="store-name_wordalign">广州天汇广场</div>
                                                        <div>广州市天河区兴民路222号天汇广场3层</div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div id="addSelect" class="addSelect" style="display: none;">
                                                <div id="itemOnPage1" class="form-group col-sm-12 col-xs-12 nopad">
                                                    <!-- ********************************************************************************************************************************* -->
                                                    <input type="hidden" name="orders" value="1" />
                                                    <input type="hidden" id="emptyCheckErrorMessage1" name="emptyCheckErrorMessage1" value="请联系工作人员选择地址" />
                                                    <input type="hidden" id="uniqueCheckErrorMessage1" name="uniqueCheckErrorMessage_1" value="" />
                                                    <input type="hidden" id="validCheckErrorMessage1" name="validCheckErrorMessage_1" value="" />
                                                    <input type="hidden" name="HiddenFieldID1" value="174" />
                                                    <!-- ********************************************************************************************************************************* -->
                                                    <ul>
                                                        <li id="foli1" class=" col-sm-12 col-xs-12 nopad " style="top: 0px; left: 0px;">
                                                            <label for="Field1" id="title1" class="frmquestion cstm_frmquestion desc">
                                                                领取地点：
                                                                <span id="req_1" class="req">*</span>
                                                            </label>
                                                            <div class="frmanswer cstm_frmanswer iselect">
                                                                <select id="Field1" name="Field1" class="field select medium typtxt col-sm-6 col-xs-12">
                                                                    <!-- ********************************************************************************************************************************* -->
                                                                    <option value="224" selected="selected">-- Please Select --</option>
                                                                    <option value="225">王府中环店</option>
                                                                    <option value="226">伊势丹店</option>
                                                                    <option value="227">大丸店</option>
                                                                    <option value="244">金融中心店</option>
                                                                    <option value="245">皇庭广场店</option>
                                                                    <option value="246">天汇广场店</option>
                                                                    <option value="254">蓝色港湾店</option>
                                                                    <option value="255">合生汇购物中心店</option>
                                                                    <option value="256">荟聚购物中心店</option>
                                                                    <option value="275">双安店</option>
                                                                    <option value="276">高岛屋店</option>
                                                                    <option value="277">长宁来福士店</option>
                                                                    <!-- ********************************************************************************************************************************* -->
                                                                </select>
                                                            </div>
                                                            <p id="Type1" style="display: none; clear: both;">
                                                                <input type="hidden" name="fieldtype_1" id="fieldtype_1" value="select" />
                                                            </p>
                                                            <p id="ErrMsg1" class="siderror" style="display: none; clear: both;">&nbsp;</p>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </div>
                                            <div>&nbsp;</div>
                                            <div style="font-size: 10px;">
                                                <div>&nbsp;</div>
                                                <div>条款及细则:</div>
                                                <div>1.活动期间，J SELECT会员到店立享购物九折(部分品牌)。</div>
                                                <div>2.每位会员仅可获赠会员尊享好礼一次。</div>
                                                <div>3.会员尊享好礼数量有限，先到先得，送完即止。</div>
                                                <div>4.会员尊享好礼不可转让、退换或者兑换现金。</div>
                                                <div>5.本优惠仅适用于J SELECT中国大陆代理消费品业务。</div>
                                                <div>6.捷成消費品零售(上海)有限公司保留随时修改本条款及细则、更改或终止优惠之权利，而不会作另行通知。</div>
                                                <div>7.如有任何争议，捷成消費品零售(上海)有限公司保留最终决定权。</div>
                                                <div style="display: flex;">
                                                    <div>*&nbsp;</div>
                                                    <div>现金券使用规则：仅供J SELECT会员专享，可在J SELECT及J SELECT
                                                        <sub>+</sub>门店单笔消费满2000元立减100元（不叠加），配件除外，当次核销可用。</div>
                                                </div>
                                                <!-- <div style="display: flex;">
                                                        <div>*&nbsp;</div>
                                                        <div>现金券有效期：截止2018年12月31日</div>
                                                    </div> --></div>
                                        </div>
                                    <!-- </form> -->
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="foot copy_txt">&copy; 2018 J SELECT版权所有</div>
            </div>
        </div>
    </div>
    
    <script>
		var ajaxSendCouponUrl = "<?= Url::to(['campaign/ajax-send-artistic-coupon']) ?>";
    
        var parameters = {
            postUrl: ajaxSendCouponUrl,
            myCouponUrl: "<?= Url::to(['member/coupon']) ?>",
            source: "<?= $source ?>",
            userInfo: <?= $userInfo ?>, // 用户信息
            webform_url: "<?= $webform_url ?>", // 新用户 - url 老用户 - 空
            couponStatus: "<?= $couponStatus ?>", // 新用户 - false 老用户 - true
            jumpStatus: "<?= $jumpStatus ?>", // 新用户 - false 老用户 - true
            
        }
        if (parameters.webform_url || !parameters.couponStatus || !parameters.jumpStatus) {
            $("#submitFormBtn").addClass('disabled').attr('disabled', true);
            $(".copy").show()
        }
        if (parameters.source=='wechat') {
            if(parameters.couponStatus == 'y' || parameters.jumpStatus == 'y') {
                $('.js-getCoupon').show()
                $('.js-myCoupon').show()
            }else{
                $('.js-register').show()
            }
        }
        if (parameters.source=='sms') {
            if(parameters.couponStatus == 'y' || parameters.jumpStatus == 'y') {
                $('.js-getCoupon').show()
                $('.js-myCoupon').show()
            }else{
                $('.js-copy').show()
            }
        }
        $('.js-getCoupon').click(function(){
            getCoupon()
        })
        $('.js-myCoupon').click(function(){
            myCoupon()
        })
        $('.js-register').click(function(){
            register()
        })
        $('.js-copy').click(function(){
            copyText()
        })
        function getCoupon() {
            message({message:'请稍后！',time:1500})
            $.post(parameters.postUrl, function(re){
                if(re.status == 'success'){
                    message({type:'success',message:re.message})
                } else {
                    message({type:'error',message:re.message})
                }
            }, 'json').error(function() { 
                message({type:'error',message:'发送请求失败，请稍后再试！'}) 
            })
        }
        function myCoupon() {
            window.location.href = parameters.myCouponUrl
        }
        function register() {
            window.location.href = parameters.webform_url
        }
        function copyText() {
            var text = document.getElementById("brandName").innerText;
            var word = document.getElementById("copyBrandName");
            word.value = text; // 修改文本框的内容
            word.select(); // 选中文本
            document.execCommand("copy"); // 执行浏览器复制命令
            message({type:'success',message:'复制成功'})
        }
        function message(obj) {
            var type = obj.type || 'info';
            var message = obj.message || 'nothing';
            var time = obj.time || 3000;
            var id = Math.floor(Math.random()*10000)
            var html = '<div id="'+id+'" class="el-message el-message--'+type+'" style="z-index: 2000;"><p class="el-message__content">'+message+'</p></div>'
            
            $("body").append(html)
            setTimeout(function(){
                $("#"+id).remove()
            },time)
        }
    </script>
</body>

</html>
